#include<iostream>
using namespace std;
const int N = 1010;
int arr[N][N];
int st[N][N];
int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
int n, m;
int main()
{
	cin >> n >> m;
	int k = 2;
	int x = 1, y = 1;
	arr[1][1] = 1;
	while (k <= n * m) {
		for (int i = 0; i < 4; i++) {
			int a = dx[i] + x;
			int b = dy[i] + y;
			if (a <= 0 || a > n || b <= 0 || b > m)continue;
			if (st[a][b])continue;
			st[a][b] = 1;
			arr[a][b] = k++;
			x = a, y = b;
			break;
		}
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			cout << arr[i][j] << " ";
		}
		cout << endl;
	}
	return 0;
}